package com.Archive.secondWeek;
public class rabbits {
    public int mouth = 20;
    public int rabbits_mature = 1;
    public int rabbits_maturityCycle = 2;
    public int[] rabbits_growing = new int[99];

    public int produce() {
        int rabbits_muture = 0;
        for (int i = 0; i < rabbits_growing.length; i++) {
            if (rabbits_growing[i] == rabbits_maturityCycle) {
                rabbits_muture += 1;
                rabbits_growing[i] = 0;
            } else if (rabbits_growing[i] < rabbits_maturityCycle && rabbits_growing[i] > 0) {
                rabbits_growing[i]++;
            }
        }
        return rabbits_muture;
    }

    public void rabbit_new(int n) {
        for (int i = 0; i < n; i++) {
            Label:
            {
                for (int j = 0; j < rabbits_growing.length; j++) {
                    if (rabbits_growing[j] == 0) {
                        rabbits_growing[j] = 1;
                        break Label;
                    }
                }
            }
        }
    }

    public static void main(String[] args) {
        rabbits t = new rabbits();
        for (int m = 0; m < t.mouth; m++) {
            t.rabbit_new(t.rabbits_mature);
            t.rabbits_mature = t.rabbits_mature + t.rabbits_mature + t.produce();

            System.out.println("---" + m + "mouth --- " + t.rabbits_mature + "rabbits --- ");
            for (int l = 0; l < 3; l++) {
                for (int d = 0; d < 33; d++) {
                    System.out.print(t.rabbits_growing[(l * 33) + d] + "\t");
                }
                System.out.print("\n");
            }
        }
        System.out.println();

    }

}

